<?php

class Core_Table_Website_Sef extends Kd_Data_Table {

    public function __construct() {
        parent::__construct();
    }

    public function getBySourceId($id, $type) {
        return Kd_Data_Factory::getQueryDcl()
                ->from($this->getName())
                ->where()
                ->eq('source_id', ':sourceId:i')
                ->eq('source_type', ':type:s')
                ->closest()
                ->addParameter(array('sourceId' => $id, 'type' => $type))
                ->setDbDriver($this->getDbDriver())
                ->fetch()
                ->getFirstRow();
    }

    public function getBySourceUrl($url, $type) {
        return Kd_Data_Factory::getQueryDcl()
                ->from($this->getName())
                ->where()
                ->eq('source_url', ':sourceUrl:s')
                ->eq('source_type', ':type:s')
                ->closest()
                ->addParameter(array('sourceUrl' => $url, 'type' => $type))
                ->setDbDriver($this->getDbDriver())
                ->fetch()
                ->getFirstRow();
    }

}